package com.ruoyi.web.controller.lims;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.lims.domain.LimsTaskBatch;
import com.ruoyi.lims.service.ILimsTaskBatchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.Collection;
import java.util.List;

/**
 * 上机-运营补充Controller
 *
 * @author wry
 * @date 2023-07-19
 */
@RestController
@RequestMapping("/batch/batch")
public class LimsTaskBatchController extends BaseController
{
    @Autowired
    private ILimsTaskBatchService limsTaskBatchService;

    /**
     * 查询上机-运营批次列表
     */
    @PreAuthorize("@ss.hasPermi('lims:batch:list')")
    @GetMapping("/list")
    public TableDataInfo list(LimsTaskBatch limsTaskBatch)
    {
        startPage();
        List<LimsTaskBatch> list = limsTaskBatchService.selectLimsTaskBatchList(limsTaskBatch);
        return getDataTable(list);
    }
        /**
     * 删除上机-运营补充
     */
    @PreAuthorize("@ss.hasPermi('lims:batch:remove')")
    @Log(title = "批次-批次删除", businessType = BusinessType.DELETE)
	@DeleteMapping("/{batchIds}")
    public AjaxResult remove(@PathVariable Collection<Long> batchIds)
    {
        return toAjax(limsTaskBatchService.deleteLimsTaskBatchByBatchIds(batchIds));
    }

    /**
     * 批次-批次提交
     */
    @PreAuthorize("@ss.hasPermi('lims:batch:remove')")
    @Log(title = "批次-批次提交", businessType = BusinessType.OTHER)
    @GetMapping("submitBatch/{batchIds}")
    public AjaxResult submitBatch(@PathVariable Collection<Long> batchIds)
    {
        String message=limsTaskBatchService.submitLimsTaskBatchByBatchIds(batchIds);
        return success(message);
    }
}
